﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WiTeach.CourseManagement.View;
using System.Diagnostics;

namespace WiTeach.ClassManagement.View
{
    /// <summary>
    /// ProgramrRecording.xaml 的交互逻辑
    /// </summary>
    public partial class ProgramRecording : Page
    {
        public int lessonID;
        public int classHourID;
        public ProgramRecording(int lessonID, int classHourID)
        {
            InitializeComponent();
            // 修改页面背景主题
            ImageBrush brush = new ImageBrush();
            brush.Stretch = Stretch.Fill;
            brush.ImageSource = new BitmapImage(new Uri(App.backgroundImage, UriKind.RelativeOrAbsolute));
            this.Background = brush;
            this.lessonID = lessonID;
            this.classHourID = classHourID;
        }

        private void backHome(object sender, RoutedEventArgs e)
        {
            CourseIndex courseIndex = new CourseIndex();
            this.NavigationService.Navigate(courseIndex);
        }

        private void backPreLevel(object sender, RoutedEventArgs e)
        {
            this.NavigationService.GoBack();
        }

        private void ProgramWriting(object sender, RoutedEventArgs e)
        {
            // 跳转至程序编写页面
            ProgramWriting programWritingPage = new ProgramWriting(lessonID, classHourID);
            this.NavigationService.Navigate(programWritingPage);
        }


        private void TeachingDemonstration(object sender, RoutedEventArgs e)
        {
            TeachingDemonstration teachingPage = new TeachingDemonstration(lessonID, classHourID);
            this.NavigationService.Navigate(teachingPage);
        }

        private void progisp_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string progisp_path = System.Configuration.ConfigurationManager.AppSettings["app_progisp"];
                //  System.Diagnostics.Process.Start(@progisp_path);
                Process progisp = new Process();
                progisp.StartInfo.FileName = progisp_path;
                progisp.Start();
                progisp.WaitForExit();
                progisp.Close();
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex);
            }
        }

        private void flymcu_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string flymcu_path = System.Configuration.ConfigurationManager.AppSettings["app_flymcu"];
                //          System.Diagnostics.Process.Start(@flymcu_path);
                Process flymcu = new Process();
                flymcu.StartInfo.FileName = flymcu_path;
                flymcu.Start();
                flymcu.WaitForExit();
                flymcu.Close();
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex);
            }

            

        }

        private void program_recording_backmain_mouse_enter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 66;
            image.Width = 104;
        }
        private void program_recording_backmain_mouse_leave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 60;
            image.Width = 98;
        }
        private void program_recording_back_mouse_enter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 66;
            image.Width = 104;
        }
        private void program_recording_back_mouse_leave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 60;
            image.Width = 98;
        }

        private void program_recording_choice_mouse_enter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 250;
            image.Width = 256;
        }
        private void program_recording_choice_mouse_leave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 244;
            image.Width = 250;
        }
        private void program_recording_program_enter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 100;
            image.Width = 96;
        }
        private void program_recording_program_leave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 94;
            image.Width = 90;
        }

        private void program_recording_demonstrate_enter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 84;
            image.Width = 96;
        }
        private void program_recording_demonstrate_leave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 80;
            image.Width = 90;
        }
    }
}
